<!DOCTYPE html>
<html th:lang="${language}" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header(#{okr.my})" />
    <th:block th:include="include :: okr-css" />
    <style>
        .col-md-6 {
            border-width: 20px;
        }
    </style>
</head>
<body>
<div class="container-div">
    <div class="col-sm-6">
        <div class="panel panel-primary">
            <div class="panel-heading">
                最近3天设置的任务
            </div>
            <div class="panel-body">
                <div class="col-sm-8 select-table table-striped">
                    <table id="bootstrap-table-task-3"></table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="panel panel-success">
            <div class="panel-heading">
                当前周期我的目标
            </div>
            <div class="panel-body">
                <div class="col-sm-8 select-table table-striped">
                    <table id="bootstrap-table-okr"></table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="panel panel-info">
            <div class="panel-heading">
                近7天设置的任务
            </div>
            <div class="panel-body">
                <div class="col-sm-8 select-table table-striped">
                    <table id="bootstrap-table-task-7"></table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="panel panel-info">
            <div class="panel-heading">
                进行中的任务
            </div>
            <div class="panel-body">
                <div class="col-sm-8 select-table table-striped">
                    <table id="bootstrap-table-task-status"></table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="panel panel-danger">
            <div class="panel-heading">
                三天内截止的任务
            </div>
            <div class="panel-body">
                <div class="col-sm-8 select-table table-striped">
                    <table id="bootstrap-table-task-endForThree"></table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="panel panel-danger">
            <div class="panel-heading">
                七天内截止的任务
            </div>
            <div class="panel-body">
                <div class="col-sm-8 select-table table-striped">
                    <table id="bootstrap-table-task-endForSeven"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/task";

    $(function() {
        var options = {
            id: "bootstrap-table-task-endForSeven",
            url: "workbench/getTaskListForEndSeven",
            // url: prefix + "/list",
            showSearch:false,
            showToggle:false,
            showColumns: false,
            modalName: "任务管理",
            showRefresh: false,
            onDblClickRow: queryTask,
            columns: [
                // {
                //     checkbox: false
                // },
                {
                    field: 'taskName',
                    title: '任务'
                },
                {
                    field: 'beginTime',
                    title: '开始时间'
                },
                {
                    field: 'priority',
                    title: '优先级'
                },
                {
                    field: 'type',
                    title: '类型'
                }
            ]
        };
        $.table.init(options);
    });

    $(function() {
        var options = {
            id: "bootstrap-table-task-endForThree",
            url: "workbench/getTaskListForEndThree",
            // url: prefix + "/list",
            showSearch:false,
            showToggle:false,
            showColumns: false,
            modalName: "任务管理",
            showRefresh: false,
            onDblClickRow: queryTask,
            columns: [
                // {
                //     checkbox: false
                // },
                {
                    field: 'taskName',
                    title: '任务'
                },
                {
                    field: 'beginTime',
                    title: '开始时间'
                },
                {
                    field: 'priority',
                    title: '优先级'
                },
                {
                    field: 'type',
                    title: '类型'
                }
            ]
        };
        $.table.init(options);
    });

    $(function() {
        var options = {
            id: "bootstrap-table-task-3",
            url: "workbench/getTaskListToday",
            // url: prefix + "/list",
            showSearch:false,
            showToggle:false,
            showColumns: false,
            modalName: "任务管理",
            showRefresh: false,
            onDblClickRow: queryTask,
            columns: [
        // {
            //     checkbox: false
            // },
                {
                    field: 'taskName',
                    title: '任务'
                },
                {
                    field: 'beginTime',
                    title: '开始时间'
                },
                {
                    field: 'priority',
                    title: '优先级'
                },
                {
                    field: 'type',
                    title: '类型'
                }
            ]
        };
        $.table.init(options);
    });

    function queryTask(row, $element){
        console.log("就这")
        $.modal.open("任务信息", ctx + "system/task/edit/" + row.id)
    }


    $(function() {
        var options = {
            id: "bootstrap-table-okr",
            url: "workbench/getOKRList",
            // url: prefix + "/list",
            showSearch:false,
            showToggle:false,
            showColumns: false,
            showRefresh: false,
            columns: [
                {
                    field: 'selectItem',
                    checkbox: false
                },
                {
                    field: 'content',
                    title: [[#{okr.content}]],
                    classes: 'col-md-5 col-sm-5',
                    formatter: function (value, row, index) {
                        if(row.rowType === 0){
                            return '<H4>' + value + '</H4>';
                        }
                    }
                },
                {
                    field: 'confidenceStar',
                    title: [[#{okr.confidenceStar}]],
                    formatter: function (value, row, index) {
                        return '<span class="badge badge-success">' + value + '</span>';
                    }
                },
                {
                    field: 'scoreStar',
                    title: [[#{okr.scoreStar}]],
                    formatter: function (value, row, index) {
                        return '<span class="badge badge-success">' + value + '</span>';
                    }
                },
                {
                    field: 'process',
                    title: [[#{okr.progress}]],
                    formatter: function (value, row, index) {
                        return '<span class="badge badge-success">' + value  + '%</span>';
                    }
                },
                // {
                //     field: 'priority',
                //     title: [[#{okr.priority}]],
                //     formatter: function (value, row, index) {
                //         return "<span class='badge badge-success'><i class='fa fa-flag-checkered'></i></span>"
                //     }
                // }
                ]
        };
        $.table.init(options);
    });


    $(function() {
        var options = {
            id: "bootstrap-table-task-7",
            url: "workbench/getTaskListTodayForSeven",
            // url: prefix + "/list",
            showSearch:false,
            showToggle:false,
            showColumns: false,
            modalName: "任务管理",
            showRefresh: false,
            onDblClickRow: queryTask,
            columns: [
                // {
                //     checkbox: false
                // },
                {
                    field: 'taskName',
                    title: '任务'
                },
                {
                    field: 'beginTime',
                    title: '开始时间'
                },
                {
                    field: 'priority',
                    title: '优先级'
                },
                {
                    field: 'type',
                    title: '类型'
                }
            ]
        };
        $.table.init(options);
    });


    $(function() {
        var options = {
            id: "bootstrap-table-task-status",
            url: "workbench/getTaskStatus",
            // url: prefix + "/list",
            showSearch:false,
            showToggle:false,
            showColumns: false,
            modalName: "任务管理",
            showRefresh: false,
            onDblClickRow: queryTask,
            columns: [
                {
                    field: 'taskName',
                    title: '任务'
                },
                {
                    field: 'beginTime',
                    title: '开始时间'
                },
                {
                    field: 'priority',
                    title: '优先级'
                },
                {
                    field: 'type',
                    title: '类型'
                }
            ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>